<template>
	<view class="welcome">
		<view class="words">欢迎使用</view>
		<view class="client">XXXX客户端</view>
		<view class="identity">请选择您的身份</view>
		<view class="obligor" @click="num='1'">
			<image src="../static/images/obligorChecked.png" mode="" class="creditorChecked" v-if="num=='1'"></image>
			<image src="../static/images/creditorChecked.png" mode="" class="creditorChecked" v-else></image>
			<view class="name">我是债务人</view>
		</view>
		<view class="creditor" @click="num='2'">
			<image src="../static/images/creditorChecked.png" mode="" class="creditorChecked" v-if="num=='1'"></image>
			<image src="../static/images/obligorChecked.png" mode="" class="creditorChecked" v-else></image>
			<view class="name">我是债权人</view>
		</view>
		<view class="button" @click="enterSystem">进入系统</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				num: '1',
			}
		},
		components: {

		},
		methods: {
			//债务人注册界面
			registration() {
				uni.removeStorage({key: 'token',});
				uni.redirectTo({
					url: '/pages/loanee/login/registration'
				});
			},
			//债权人登录界面
			login() {
				uni.removeStorage({key: 'token',});
				uni.redirectTo({
					url: '/pages/creditor/login/index'
				});
			},
			//债务人首页
			obligor() {
				uni.switchTab({
					url: '/pages/loanee/obligor/index'
				})
			},
			//债权人首页
			creditor() {
				uni.switchTab({
					url: '/pages/creditor/personam/index'
				})
			},
			enterSystem() {
				let group_id = uni.getStorageSync('group_id');
				if (group_id && this.num == group_id) {
					if (this.num == 1) {
						this.obligor()
					
					} else {
						
						this.creditor()
					}

				} else {
					if (this.num == '1') {
						this.registration()
					} else {
						this.login()
					}
				}


			}
		},
		mounted() {
 
		},
		watch: {

		},
		computed: {

		}
	}
</script>

<style scoped lang='scss'>
	.welcome {
		background-image: url('../static/images/welcome.png');
		width: 100%;
		height: 1334rpx;
		display: flex;
		align-items: center;
		flex-direction: column;
		background-size: 100%;
	}

	.words {
		margin-top: 135rpx;
		font-size: 88rpx;
		color: #222223;
	}

	.client {
		font-size: 50rpx;
		color: #222223;
	}

	.identity {
		color: #222223;
		font-size: 30rpx;
		margin-top: 40rpx;
	}

	.creditorChecked {
		width: 26rpx;
		height: 26rpx;
		margin-top: 6rpx;
	}

	.obligor {
		margin-top: 242rpx;
		display: flex;
	}

	.creditor {
		margin-top: 104rpx;
		display: flex;
	}

	.name {
		margin-left: 16rpx;
	}

	.button {
		margin-top: 374rpx;
		width: 236rpx;
		height: 100rpx;
		background: #E24D49;
		border-radius: 10rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		color: #FFFFFF;
		font-size: 36rpx;
	}
</style>
